package com.wl4g.sample.callgo.sample4;

import java.util.Arrays;

import com.sun.jna.Native;
import com.sun.jna.Pointer;

/**
 * {@link App4}
 * 
 * @author Wangl.sir &lt;wanglsir@gmail.com, 983708408@qq.com&gt;
 * @version 2020年6月21日 v1.0.0
 * @see https://java-native-access.github.io/jna/4.2.1/overview-summary.html
 * @see https://github.com/senx/warp10-ext-jnago
 */
public class App4 {

	static {
		Native.setProtected(true);
	}

	public static void main(String[] args) throws Exception {
		Pointer res = LibSample4.INSTANCE.Hello();
		// [read1]
		System.out.println(Arrays.toString(res.getByteArray(0, 2)));
		// [read2]
		System.out.println(Arrays.toString(res.getByteArray(2, 3)));
		// [read3] At the end of the read, the C language terminator '\0' will
		// be read
		System.out.println(Arrays.toString(res.getByteArray(5, 5)));
		Thread.sleep(10000L);
	}

}